package com.example.featuresdk.database

import com.example.featuresdk.dao.UserDao
import com.example.featuresdk.model.IconManager
import com.example.featuresdk.model.User

class CoreDatabaseCallback (private val userDao: UserDao): DatabaseCallback(){
    init {
        this.priority = Int.MIN_VALUE
    }

    override suspend fun initialize() {

        super.initialize()

        val users = mutableListOf<User>().apply {
            add(User.ME)
            var userId = User.ME.id!! + 1
            addAll(IconManager.icons.map { User(userId++,it.key,it.value) })
        }
        userDao.insert(users)
    }
}